package city.spring.modules.medicine.vo;

import city.spring.action.model.AbstractDeliveryMedicine;
import city.spring.modules.medicine.entity.MedicinedeliveryMedicineExtEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * @author 谢金婷
 * @date 2020/6/4 0004 16:48
 * @see MedicinedeliveryMedicineExtEntity
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class MedicinedeliveryMedicineVO extends MedicinedeliveryMedicineExtEntity {
    /**
     * 仓库名称
     */
    private String storehouseId;
    /**
     * 药品仓库
     */
    private String sname;
    /**
     * 货架编号
     */
    private String shelfId;
    /**
     * 药品货架
     */
    private String shelflevelname;
    /**
     * 药品名称
     */
    private String name;
    /**
     * 计量单位
     */
    private String unit;
    /**
     * 单价
     */
    private BigDecimal unitprice;
    /**
     * 库存
     */
    private BigDecimal quantity;

    /**
     * 转换成出库时所需要的对象
     *
     * @return AbstractPlanUser
     */
    public AbstractDeliveryMedicine<MedicinedeliveryMedicineVO> toDeliveryMedicine() {
        MedicinedeliveryMedicineVO item = this;
        return new AbstractDeliveryMedicine<MedicinedeliveryMedicineVO>() {

            @Override
            public Object getKey() {
                return item.getMedicineId();
            }

            @Override
            public String getName() {
                return item.getName();
            }

            @Override
            public String getStorehouseId() {
                return item.getStorehouseId();
            }

            @Override
            public String getSname() {
                return item.getSname();
            }

            @Override
            public String getShelfId() {
                return item.getShelfId();
            }

            @Override
            public String getShelflevelname() {
                return item.getShelflevelname();
            }

            @Override
            public String getUnit() {
                return item.getUnit();
            }


            @Override
            public BigDecimal getUnitprice() {
                return item.getUnitprice();
            }

            @Override
            public BigDecimal getQuantity() {
                return item.getQuantity();
            }

            @Override
            public BigDecimal getDeliveryquantity() {
                return item.getDeliveryquantity();
            }

            @Override
            public MedicinedeliveryMedicineVO getObject() {
                return item;
            }
        };
    }

}
